package io.tij;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.DoubleBuffer;

public class ViewBuffer {
	public static void main(String[] args) {
		ByteBuffer bb = ByteBuffer.wrap(
				new byte[] { 0, 0, 0, 0, 0, 0, 0, 'a' });
		bb.rewind();
		System.out.print("ByteBuffer: ");
		while(bb.hasRemaining())
			System.out.print(bb.position() + "->" + bb.get() + ", ");
		System.out.println();
		
		bb.rewind();
		CharBuffer cb = bb.asCharBuffer();
		System.out.print("CharBuffer: ");
		while(cb.hasRemaining())
			System.out.print(cb.position() + "->" + cb.get() + ", ");
		System.out.println();
		
		bb.rewind();
		DoubleBuffer db = bb.asDoubleBuffer();
		System.out.print("DoubleBuffer: ");
		while(db.hasRemaining())
			System.out.print(db.position() + "->" + db.get() + ", ");
	}

}
